import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import {list as channelList} from "/@/views/marketing/channel/Channel.api";
import dayjs from 'dayjs';

export const columns: BasicColumn[] = [
  {
    title: '渠道',
    dataIndex: 'channel'
   },
  {
    title: '渠道名称',
    dataIndex: 'channelName'
  },
   {
    title: '日期',
    dataIndex: 'joinedDate'
   },
   {
    title: '注册人数',
    dataIndex: 'amount'
   },
   {
    title: '支付人数',
    dataIndex: 'allowAmount'
   },
   {
    title: '未支付人数',
    dataIndex: 'potentialUser'
   },
];
const dateFormat = 'YYYY-MM-DD';
export const searchFormSchema: FormSchema[] = [
  {
    label: '渠道',
    field: 'channel',
    defaultValue: '3',
    component: 'ApiSelect',
    componentProps: {
      api: channelList,
      resultField: 'records',
      // use name as label
      labelField: 'name',
      // use id as value
      valueField: 'id',
      // not request untill to select
      immediate: true,
    },
    colProps: { span: 6 },
  },
  {
    field: 'fieldTime',
    component: 'RangePicker',
    label: ' 日期',
    defaultValue: [dayjs().subtract(9, 'days').format(dateFormat),dayjs().format(dateFormat)],
    colProps: {
      span: 8,
    },
  },

];

